<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Traits\ResourceController;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Request;
use App\Models\GpsadvAdver;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Arr;

class GpsadvAdverController extends Controller
{
    use ResourceController;


    /**
     * 资源模型
     * @var  string
     */
    protected $resourceModel = 'GpsadvAdver';

    /**
     * 验证规则
     * @return    array
     */
    protected function getValidateRule($id=0)
    {
        return $this->getImportValidateRule($id,Request::all());
    }

    /**
     * 验证规则
     * @return  array
     */
    protected function getImportValidateRule($id = 0, $item){
        $validate = ['title'=>'sometimes|required|unique:gpsadv_advers,title,'.$id.',id,deleted_at,NULL','expire_start_time'=>'sometimes|required|unique:gpsadv_advers,expire_start_time,'.$id.',id,deleted_at,NULL','expire_end_time'=>'sometimes|required|unique:gpsadv_advers,expire_end_time,'.$id.',id,deleted_at,NULL','banner_img'=>'sometimes|required|unique:gpsadv_advers,banner_img,'.$id.',id,deleted_at,NULL','advers_url'=>'sometimes|required|unique:gpsadv_advers,advers_url,'.$id.',id,deleted_at,NULL'];
        return $validate;
    }

    /**
    * 编辑页面数据返回处理
    * @param  $id
    * @param  $data
    * @return  mixed
    */
    protected function handleEditReturn($id,&$data){
        return $data;
    }


}
